
import base from './base'
import SwitchLine from './switchLine.vue'
import processVersionContentApi from '@/api/process/processVersionContentApi'

class SwitchPolylineView extends base.view {
	constructor(props) {
		super(props, SwitchLine)
	}
	renderNodeAfter() {

		const { properties, text, sourceNodeId, targetNodeId, sourceNode } = this.props.model;

		//找到source的节点，然后获取渲染的文本
		if (!sourceNode) {
			return
		}
		const cb = sourceNode.properties?.componentConfig?.output?.defaultNextTransformId;
		if (cb == targetNodeId) {
			properties.conditionStr = "默认";
			super.renderNodeAfter()
			return
		}
		const pipeData = sourceNode.properties?.componentConfig?.output?.pipeData;
		if (!pipeData) {
			return
		}
		for (const bb of pipeData) {
			const nextTransformId = bb.nextTransformId;
			// const conditionData = bb.conditionData;
			if (nextTransformId == targetNodeId) {
				properties.conditionStr = bb.conditionStr;
			}
		}
		// console.log(properties)
		super.renderNodeAfter()
	}
}

class SwitchPolylineModel extends base.model {

	render() {
		this.updateText("");

	}
}


export default {
	type: 'switch-line',
	model: SwitchPolylineModel,
	view: SwitchPolylineView
}
